
package com.feib.soeasy.service;

import java.lang.reflect.InvocationTargetException;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;

import com.feib.soeasy.model.PayerTemp;


/**
 * @title (#)Replace.java<br>
 * @description <br>
 * @author Jimmy Liu<br>
 * @version 1.0.0 2010/11/25
 * @copyright Far Eastern International Bank Copyright (c) 2010<br>
 * @2011/4/6 create by Jimmy Liu<br>
 */
public class Replace {

    /**
     * @param args
     * @throws NoSuchMethodException 
     * @throws InvocationTargetException 
     * @throws IllegalAccessException 
     */
    public static void main(String[] args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        String a = "一test@#二abc@#三qqq";
        System.out.println(a);
        System.out.println(StringUtils.replace(a, "@#", "\r\n"));
        
        String columnName = "parkingCount";
        Object convertedValue = new Long(10);
        PayerTemp payerTemp = new PayerTemp();
        Class<Object> classType = PropertyUtils.getPropertyType(payerTemp, columnName);
        if (classType.equals(Double.class))
        {
            convertedValue = new Double(((Long)convertedValue).doubleValue());
        }
        else if (classType.equals(Integer.class))
        {
            convertedValue = new Integer(((Long)convertedValue).intValue());
        }
        PropertyUtils.setProperty(payerTemp, columnName, convertedValue);
        System.out.println(payerTemp.getLevelGround());
        System.out.println(payerTemp.getParkingCount());

    }

}
